import { BaseResultType } from '#/request'
import useDealResult from '@/hooks/dealResult'
import uniRequest from '@/request'

const { dealResult, checkResult } = useDealResult()

export const getUseOrderInfoList = async (wxId:string): Promise<BaseResultType<any> | null> => {
    const [result, err] = await uniRequest.get('/kdg/api/getUseOrderInfoList?wxId='+wxId)
    return Promise.resolve(dealResult(err, result))
}

export const orderEnd = async (wxId:string,userStorageId:string,status:string): Promise<BaseResultType<any> | null> => {
    const [result, err] = await uniRequest.get('/kdg/api/orderEnd?wxId='+wxId+'&userStorageId='+userStorageId+"&status="+status)
    return Promise.resolve(dealResult(err, result))
}

export const getUseOrderInfoAllList = async (wxId:string): Promise<BaseResultType<any> | null> => {
    const [result, err] = await uniRequest.get('/kdg/api/getUseOrderInfoAllList?wxId='+wxId)
    return Promise.resolve(dealResult(err, result))
}
export const returnPriceAPI = async (param:any): Promise<BaseResultType<any> | null> => {
    const [result, err] = await uniRequest.post('/wxapi/order/refund',param)
    return Promise.resolve(dealResult(err, result))
}


export const noAuthMessage = async (userId:string,tzsq:string): Promise<BaseResultType<any> | null> => {
    const [result, err] = await uniRequest.get('/kdg/api/setUserSq?userId='+userId+'&tzsq='+tzsq)
    return Promise.resolve(dealResult(err, result))
}